/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pl.edu.amu.wmi.kino.visualjavafx.nodes.objects.factory;

import java.beans.IntrospectionException;
import org.openide.nodes.Node;
import org.openide.util.Exceptions;
import pl.edu.amu.wmi.kino.visualjavafx.nodes.factory.NodeCreator;
import pl.edu.amu.wmi.kino.visualjavafx.model.objects.shapes.Rectangle;
import pl.edu.amu.wmi.kino.visualjavafx.nodes.objects.shapes.RectangleNode;

/**
 *
 * @author psychollek
 */
public class RectangleNodeFactory implements NodeCreator{

    public boolean canCreateNodeFrom(Object obj) {
        if (obj instanceof Rectangle) return true ;
        return false;
    }

    public Node generateNode(Object obj) {
        Rectangle rct = (Rectangle) obj;
        try {
            return new RectangleNode(rct);
        } catch (IntrospectionException ex) {
            Exceptions.printStackTrace(ex);
            return null;
        }
    }

}
